/**
  * Author: Mei
  * Date: 2020-12-29 11:43
  * Description: 迭代器的对外接口
  *
  */
#include <iostream>
namespace detail_range {
    template<typename T>
    class iterator {
    public:
        typedef T value_type;
        typedef size_t size_type;
    private:
        value_type value_;  //初始值
        size_type cursor_;  //迭代的次数  一般用在次数*步长=初始值
        const value_type step_;  //迭代的步长

    public:
        iterator(size_type cur_start, value_type begin_val, value_type step_val) :
                cursor_(cur_start), //迭代次数
                value_(begin_val), //初始值
                step_(step_val) { //步长
            value_ += (step_ * cursor_);
        }

        value_type operator*() {
            return value_;
        }

        bool operator!=(const iterator &rhs) const {
            return (cursor_ != rhs.cursor_);
        }

        iterator& operator++(void) { //前置++  只读
            value_ += step_;
            ++cursor_;
            return (*this);
        }

    };


}